cmake_minimum_required(VERSION 3.20.0)

if (DEFINED CMAKE_INSTALL_PREFIX) 
	message("CMAKE_INSTALL_PREFIX:" ${CMAKE_INSTALL_PREFIX})
else()
	message("CMAKE_INSTALL_PREFIX NOT EXIST, USE CMAKE_BINARY_DIR:" ${CMAKE_BINARY_DIR})
	set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})
endif()

project (cmake-install-package VERSION 1.0.0)

add_executable(${PROJECT_NAME} main.cpp)

add_subdirectory(MyMath)
find_package(MyMath PATHS ${CMAKE_CURRENT_SOURCE_DIR}/MyMath/install NO_DEFAULT_PATH)
target_include_directories(${PROJECT_NAME} PUBLIC MyMath)
target_link_libraries(${PROJECT_NAME} PUBLIC MyMath)

# https://cmake.org/cmake/help/latest/command/find_package.html
# https://www.jianshu.com/p/f983a90bcf91
# https://www.jianshu.com/p/a0915895dbbc

# https://blog.csdn.net/sinat_31608641/article/details/121712590